{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "ExecuteTime": {
     "end_time": "2025-06-09T06:09:39.956283Z",
     "start_time": "2025-06-09T06:09:39.652730900Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "outputs": [
    {
     "data": {
      "text/plain": "Attrition\n0    922\n1    178\nName: count, dtype: int64"
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data = pd.read_csv('../data/train.csv')\n",
    "data['Attrition'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-09T06:09:41.417218300Z",
     "start_time": "2025-06-09T06:09:41.401676200Z"
    }
   },
   "id": "17038694126c1620"
  },
  {
   "cell_type": "code",
   "execution_count": 226,
   "outputs": [
    {
     "data": {
      "text/plain": "    Attrition  Age     BusinessTravel              Department  \\\n0           0   37      Travel_Rarely  Research & Development   \n1           0   54  Travel_Frequently  Research & Development   \n2           1   34  Travel_Frequently  Research & Development   \n3           0   39      Travel_Rarely  Research & Development   \n4           1   28  Travel_Frequently  Research & Development   \n5           0   24      Travel_Rarely                   Sales   \n6           0   29      Travel_Rarely  Research & Development   \n7           0   36      Travel_Rarely                   Sales   \n8           0   33      Travel_Rarely  Research & Development   \n9           0   34      Travel_Rarely  Research & Development   \n10          1   24      Travel_Rarely         Human Resources   \n11          0   35      Travel_Rarely  Research & Development   \n12          1   30      Travel_Rarely  Research & Development   \n13          0   54      Travel_Rarely  Research & Development   \n14          0   34      Travel_Rarely  Research & Development   \n15          0   47      Travel_Rarely                   Sales   \n16          0   36         Non-Travel                   Sales   \n17          0   35      Travel_Rarely  Research & Development   \n18          0   29      Travel_Rarely                   Sales   \n19          1   56      Travel_Rarely  Research & Development   \n20          0   45      Travel_Rarely  Research & Development   \n21          0   46      Travel_Rarely  Research & Development   \n22          0   39      Travel_Rarely  Research & Development   \n23          0   52      Travel_Rarely                   Sales   \n24          0   32         Non-Travel  Research & Development   \n25          0   46  Travel_Frequently  Research & Development   \n26          0   28      Travel_Rarely  Research & Development   \n27          0   29      Travel_Rarely  Research & Development   \n28          0   39      Travel_Rarely                   Sales   \n29          0   33      Travel_Rarely  Research & Development   \n\n    DistanceFromHome  Education    EducationField  EmployeeNumber  \\\n0                  1          4     Life Sciences              77   \n1                  1          4     Life Sciences            1245   \n2                  7          3     Life Sciences             147   \n3                  1          1     Life Sciences            1026   \n4                  1          3           Medical            1111   \n5                  4          1           Medical            1445   \n6                  9          5             Other             455   \n7                  2          2           Medical             513   \n8                  4          4           Medical             305   \n9                  2          4  Technical Degree            1383   \n10                22          1   Human Resources            1714   \n11                10          4           Medical            1587   \n12                 3          3  Technical Degree             297   \n13                 8          4     Life Sciences             578   \n14                 1          3     Life Sciences            1447   \n15                 2          4     Life Sciences             925   \n16                15          4         Marketing            2036   \n17                 1          4           Medical            1172   \n18                19          3     Life Sciences            1497   \n19                14          4     Life Sciences             161   \n20                10          2     Life Sciences             544   \n21                 1          4           Medical             288   \n22                10          1           Medical            1800   \n23                 3          4         Marketing             776   \n24                 1          3     Life Sciences             951   \n25                18          1           Medical             624   \n26                17          2           Medical             536   \n27                23          2     Life Sciences             824   \n28                24          1         Marketing            2056   \n29                 9          3           Medical            1238   \n\n    EnvironmentSatisfaction  Gender  ...  RelationshipSatisfaction  \\\n0                         1    Male  ...                         3   \n1                         4  Female  ...                         1   \n2                         1    Male  ...                         4   \n3                         4  Female  ...                         3   \n4                         1    Male  ...                         1   \n5                         4  Female  ...                         3   \n6                         2    Male  ...                         3   \n7                         2    Male  ...                         2   \n8                         3  Female  ...                         4   \n9                         3  Female  ...                         4   \n10                        4    Male  ...                         3   \n11                        1  Female  ...                         3   \n12                        4  Female  ...                         3   \n13                        3  Female  ...                         3   \n14                        4  Female  ...                         1   \n15                        4  Female  ...                         1   \n16                        4    Male  ...                         1   \n17                        4    Male  ...                         2   \n18                        3    Male  ...                         3   \n19                        2  Female  ...                         1   \n20                        1    Male  ...                         4   \n21                        4    Male  ...                         3   \n22                        3    Male  ...                         3   \n23                        3    Male  ...                         1   \n24                        3  Female  ...                         3   \n25                        1  Female  ...                         4   \n26                        3    Male  ...                         4   \n27                        3    Male  ...                         3   \n28                        2  Female  ...                         1   \n29                        1    Male  ...                         2   \n\n    StandardHours StockOptionLevel  TotalWorkingYears TrainingTimesLastYear  \\\n0              80                1                  7                     2   \n1              80                1                 33                     2   \n2              80                0                  9                     3   \n3              80                1                 21                     3   \n4              80                2                  1                     2   \n5              80                2                  5                     3   \n6              80                0                  4                     2   \n7              80                2                 10                     2   \n8              80                0                  7                     3   \n9              80                0                 14                     2   \n10             80                1                  1                     2   \n11             80                0                 10                     4   \n12             80                0                  8                     5   \n13             80                0                 19                     3   \n14             80                1                  7                     2   \n15             80                0                  3                     3   \n16             80                1                 15                     4   \n17             80                1                 10                     2   \n18             80                2                 10                     3   \n19             80                3                  7                     2   \n20             80                2                  8                     3   \n21             80                1                 17                     3   \n22             80                0                  9                     3   \n23             80                0                 34                     3   \n24             80                0                  5                     3   \n25             80                0                 28                     3   \n26             80                1                 10                     2   \n27             80                1                 10                     3   \n28             80                1                 21                     2   \n29             80                1                 15                     5   \n\n    WorkLifeBalance  YearsAtCompany YearsInCurrentRole  \\\n0                 4               7                  5   \n1                 1               5                  4   \n2                 3               9                  7   \n3                 3              21                  6   \n4                 3               1                  0   \n5                 3               5                  4   \n6                 3               3                  2   \n7                 3              10                  9   \n8                 3               3                  2   \n9                 4              14                 11   \n10                3               1                  0   \n11                3               5                  2   \n12                3               5                  2   \n13                3               1                  0   \n14                2               5                  4   \n15                2               3                  2   \n16                2              15                 12   \n17                3               8                  0   \n18                3              10                  7   \n19                3               5                  4   \n20                2               2                  2   \n21                3               4                  2   \n22                3               4                  3   \n23                4              34                  6   \n24                3               3                  0   \n25                2               2                  2   \n26                3              10                  0   \n27                3              10                  7   \n28                2              20                  9   \n29                3              14                 10   \n\n   YearsSinceLastPromotion  YearsWithCurrManager  \n0                        0                     7  \n1                        1                     4  \n2                        0                     6  \n3                       11                     8  \n4                        0                     0  \n5                        0                     3  \n6                        2                     2  \n7                        9                     0  \n8                        1                     1  \n9                        4                    11  \n10                       0                     0  \n11                       0                     4  \n12                       0                     4  \n13                       0                     0  \n14                       0                     2  \n15                       1                     2  \n16                      11                    11  \n17                       1                     7  \n18                       0                     4  \n19                       4                     3  \n20                       0                     2  \n21                       0                     3  \n22                       2                     2  \n23                       1                    16  \n24                       0                     2  \n25                       1                     2  \n26                       1                     8  \n27                       0                     7  \n28                       9                     6  \n29                       4                    10  \n\n[30 rows x 31 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Attrition</th>\n      <th>Age</th>\n      <th>BusinessTravel</th>\n      <th>Department</th>\n      <th>DistanceFromHome</th>\n      <th>Education</th>\n      <th>EducationField</th>\n      <th>EmployeeNumber</th>\n      <th>EnvironmentSatisfaction</th>\n      <th>Gender</th>\n      <th>...</th>\n      <th>RelationshipSatisfaction</th>\n      <th>StandardHours</th>\n      <th>StockOptionLevel</th>\n      <th>TotalWorkingYears</th>\n      <th>TrainingTimesLastYear</th>\n      <th>WorkLifeBalance</th>\n      <th>YearsAtCompany</th>\n      <th>YearsInCurrentRole</th>\n      <th>YearsSinceLastPromotion</th>\n      <th>YearsWithCurrManager</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>37</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>77</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>4</td>\n      <td>7</td>\n      <td>5</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>0</td>\n      <td>54</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>1245</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>1</td>\n      <td>33</td>\n      <td>2</td>\n      <td>1</td>\n      <td>5</td>\n      <td>4</td>\n      <td>1</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1</td>\n      <td>34</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>7</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>147</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>4</td>\n      <td>80</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>9</td>\n      <td>7</td>\n      <td>0</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>0</td>\n      <td>39</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>1026</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>1</td>\n      <td>21</td>\n      <td>3</td>\n      <td>3</td>\n      <td>21</td>\n      <td>6</td>\n      <td>11</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1</td>\n      <td>28</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1111</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>0</td>\n      <td>24</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>4</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>1445</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>2</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>5</td>\n      <td>Other</td>\n      <td>455</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>0</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>0</td>\n      <td>36</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>513</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>2</td>\n      <td>80</td>\n      <td>2</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>9</td>\n      <td>9</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>0</td>\n      <td>33</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>4</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>305</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>4</td>\n      <td>80</td>\n      <td>0</td>\n      <td>7</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>0</td>\n      <td>34</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Technical Degree</td>\n      <td>1383</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>4</td>\n      <td>80</td>\n      <td>0</td>\n      <td>14</td>\n      <td>2</td>\n      <td>4</td>\n      <td>14</td>\n      <td>11</td>\n      <td>4</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>1</td>\n      <td>24</td>\n      <td>Travel_Rarely</td>\n      <td>Human Resources</td>\n      <td>22</td>\n      <td>1</td>\n      <td>Human Resources</td>\n      <td>1714</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>1</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>1587</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>0</td>\n      <td>10</td>\n      <td>4</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>1</td>\n      <td>30</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Technical Degree</td>\n      <td>297</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>0</td>\n      <td>8</td>\n      <td>5</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>0</td>\n      <td>54</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>8</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>578</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>0</td>\n      <td>19</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>0</td>\n      <td>34</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1447</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>0</td>\n      <td>47</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>925</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>0</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>0</td>\n      <td>36</td>\n      <td>Non-Travel</td>\n      <td>Sales</td>\n      <td>15</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>2036</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>1</td>\n      <td>15</td>\n      <td>4</td>\n      <td>2</td>\n      <td>15</td>\n      <td>12</td>\n      <td>11</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>1172</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>2</td>\n      <td>80</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>8</td>\n      <td>0</td>\n      <td>1</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>19</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1497</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>2</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>1</td>\n      <td>56</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>14</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>161</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>3</td>\n      <td>7</td>\n      <td>2</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>0</td>\n      <td>45</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>544</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>4</td>\n      <td>80</td>\n      <td>2</td>\n      <td>8</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>0</td>\n      <td>46</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>288</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>1</td>\n      <td>17</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>0</td>\n      <td>39</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>1800</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>0</td>\n      <td>52</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>3</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>776</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>0</td>\n      <td>34</td>\n      <td>3</td>\n      <td>4</td>\n      <td>34</td>\n      <td>6</td>\n      <td>1</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>0</td>\n      <td>32</td>\n      <td>Non-Travel</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>951</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>0</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>0</td>\n      <td>46</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>18</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>624</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>4</td>\n      <td>80</td>\n      <td>0</td>\n      <td>28</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>0</td>\n      <td>28</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>17</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>536</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>4</td>\n      <td>80</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>0</td>\n      <td>1</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>23</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>824</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>3</td>\n      <td>80</td>\n      <td>1</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>0</td>\n      <td>39</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>24</td>\n      <td>1</td>\n      <td>Marketing</td>\n      <td>2056</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>...</td>\n      <td>1</td>\n      <td>80</td>\n      <td>1</td>\n      <td>21</td>\n      <td>2</td>\n      <td>2</td>\n      <td>20</td>\n      <td>9</td>\n      <td>9</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>0</td>\n      <td>33</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1238</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>...</td>\n      <td>2</td>\n      <td>80</td>\n      <td>1</td>\n      <td>15</td>\n      <td>5</td>\n      <td>3</td>\n      <td>14</td>\n      <td>10</td>\n      <td>4</td>\n      <td>10</td>\n    </tr>\n  </tbody>\n</table>\n<p>30 rows × 31 columns</p>\n</div>"
     },
     "execution_count": 226,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.561966400Z",
     "start_time": "2025-06-07T03:26:09.411255300Z"
    }
   },
   "id": "c116cd01c9563b33"
  },
  {
   "cell_type": "code",
   "execution_count": 227,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 31 columns):\n",
      " #   Column                    Non-Null Count  Dtype \n",
      "---  ------                    --------------  ----- \n",
      " 0   Attrition                 1100 non-null   int64 \n",
      " 1   Age                       1100 non-null   int64 \n",
      " 2   BusinessTravel            1100 non-null   object\n",
      " 3   Department                1100 non-null   object\n",
      " 4   DistanceFromHome          1100 non-null   int64 \n",
      " 5   Education                 1100 non-null   int64 \n",
      " 6   EducationField            1100 non-null   object\n",
      " 7   EmployeeNumber            1100 non-null   int64 \n",
      " 8   EnvironmentSatisfaction   1100 non-null   int64 \n",
      " 9   Gender                    1100 non-null   object\n",
      " 10  JobInvolvement            1100 non-null   int64 \n",
      " 11  JobLevel                  1100 non-null   int64 \n",
      " 12  JobRole                   1100 non-null   object\n",
      " 13  JobSatisfaction           1100 non-null   int64 \n",
      " 14  MaritalStatus             1100 non-null   object\n",
      " 15  MonthlyIncome             1100 non-null   int64 \n",
      " 16  NumCompaniesWorked        1100 non-null   int64 \n",
      " 17  Over18                    1100 non-null   object\n",
      " 18  OverTime                  1100 non-null   object\n",
      " 19  PercentSalaryHike         1100 non-null   int64 \n",
      " 20  PerformanceRating         1100 non-null   int64 \n",
      " 21  RelationshipSatisfaction  1100 non-null   int64 \n",
      " 22  StandardHours             1100 non-null   int64 \n",
      " 23  StockOptionLevel          1100 non-null   int64 \n",
      " 24  TotalWorkingYears         1100 non-null   int64 \n",
      " 25  TrainingTimesLastYear     1100 non-null   int64 \n",
      " 26  WorkLifeBalance           1100 non-null   int64 \n",
      " 27  YearsAtCompany            1100 non-null   int64 \n",
      " 28  YearsInCurrentRole        1100 non-null   int64 \n",
      " 29  YearsSinceLastPromotion   1100 non-null   int64 \n",
      " 30  YearsWithCurrManager      1100 non-null   int64 \n",
      "dtypes: int64(23), object(8)\n",
      "memory usage: 266.5+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.561966400Z",
     "start_time": "2025-06-07T03:26:09.421768200Z"
    }
   },
   "id": "b53c61d615fe8ad7"
  },
  {
   "cell_type": "code",
   "execution_count": 228,
   "outputs": [
    {
     "data": {
      "text/plain": "Over18\nY    1100\nName: count, dtype: int64"
     },
     "execution_count": 228,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Over18'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.561966400Z",
     "start_time": "2025-06-07T03:26:09.431324300Z"
    }
   },
   "id": "e1b4b1e176b4e2ee"
  },
  {
   "cell_type": "code",
   "execution_count": 229,
   "outputs": [
    {
     "data": {
      "text/plain": "StandardHours\n80    1100\nName: count, dtype: int64"
     },
     "execution_count": 229,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['StandardHours'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.561966400Z",
     "start_time": "2025-06-07T03:26:09.435578300Z"
    }
   },
   "id": "a7e3576faa6ebd15"
  },
  {
   "cell_type": "code",
   "execution_count": 230,
   "outputs": [
    {
     "data": {
      "text/plain": "PercentSalaryHike\n13    162\n11    156\n14    150\n12    139\n15     73\n18     71\n17     69\n19     58\n16     54\n22     45\n20     44\n21     35\n23     18\n25     14\n24     12\nName: count, dtype: int64"
     },
     "execution_count": 230,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 薪资涨幅百分比\n",
    "data['PercentSalaryHike'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.561966400Z",
     "start_time": "2025-06-07T03:26:09.444171400Z"
    }
   },
   "id": "73efdfe09e142992"
  },
  {
   "cell_type": "code",
   "execution_count": 231,
   "outputs": [
    {
     "data": {
      "text/plain": "PerformanceRating\n3    932\n4    168\nName: count, dtype: int64"
     },
     "execution_count": 231,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 绩效评比\n",
    "data['PerformanceRating'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.563968Z",
     "start_time": "2025-06-07T03:26:09.453060300Z"
    }
   },
   "id": "14ec372d3a3c894b"
  },
  {
   "cell_type": "code",
   "execution_count": 232,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 31 columns):\n",
      " #   Column                    Non-Null Count  Dtype \n",
      "---  ------                    --------------  ----- \n",
      " 0   Attrition                 1100 non-null   int64 \n",
      " 1   Age                       1100 non-null   int64 \n",
      " 2   BusinessTravel            1100 non-null   object\n",
      " 3   Department                1100 non-null   object\n",
      " 4   DistanceFromHome          1100 non-null   int64 \n",
      " 5   Education                 1100 non-null   int64 \n",
      " 6   EducationField            1100 non-null   object\n",
      " 7   EmployeeNumber            1100 non-null   int64 \n",
      " 8   EnvironmentSatisfaction   1100 non-null   int64 \n",
      " 9   Gender                    1100 non-null   object\n",
      " 10  JobInvolvement            1100 non-null   int64 \n",
      " 11  JobLevel                  1100 non-null   int64 \n",
      " 12  JobRole                   1100 non-null   object\n",
      " 13  JobSatisfaction           1100 non-null   int64 \n",
      " 14  MaritalStatus             1100 non-null   object\n",
      " 15  MonthlyIncome             1100 non-null   int64 \n",
      " 16  NumCompaniesWorked        1100 non-null   int64 \n",
      " 17  Over18                    1100 non-null   object\n",
      " 18  OverTime                  1100 non-null   object\n",
      " 19  PercentSalaryHike         1100 non-null   int64 \n",
      " 20  PerformanceRating         1100 non-null   int64 \n",
      " 21  RelationshipSatisfaction  1100 non-null   int64 \n",
      " 22  StandardHours             1100 non-null   int64 \n",
      " 23  StockOptionLevel          1100 non-null   int64 \n",
      " 24  TotalWorkingYears         1100 non-null   int64 \n",
      " 25  TrainingTimesLastYear     1100 non-null   int64 \n",
      " 26  WorkLifeBalance           1100 non-null   int64 \n",
      " 27  YearsAtCompany            1100 non-null   int64 \n",
      " 28  YearsInCurrentRole        1100 non-null   int64 \n",
      " 29  YearsSinceLastPromotion   1100 non-null   int64 \n",
      " 30  YearsWithCurrManager      1100 non-null   int64 \n",
      "dtypes: int64(23), object(8)\n",
      "memory usage: 266.5+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.563968Z",
     "start_time": "2025-06-07T03:26:09.461165100Z"
    }
   },
   "id": "7b38c33826fce027"
  },
  {
   "cell_type": "code",
   "execution_count": 233,
   "outputs": [],
   "source": [
    "# 去掉over18和standardhours\n",
    "data = data.drop(['Over18', 'StandardHours', 'EmployeeNumber'], axis=1)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.563968Z",
     "start_time": "2025-06-07T03:26:09.470619700Z"
    }
   },
   "id": "4ef7db32f58027b0"
  },
  {
   "cell_type": "code",
   "execution_count": 234,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 28 columns):\n",
      " #   Column                    Non-Null Count  Dtype \n",
      "---  ------                    --------------  ----- \n",
      " 0   Attrition                 1100 non-null   int64 \n",
      " 1   Age                       1100 non-null   int64 \n",
      " 2   BusinessTravel            1100 non-null   object\n",
      " 3   Department                1100 non-null   object\n",
      " 4   DistanceFromHome          1100 non-null   int64 \n",
      " 5   Education                 1100 non-null   int64 \n",
      " 6   EducationField            1100 non-null   object\n",
      " 7   EnvironmentSatisfaction   1100 non-null   int64 \n",
      " 8   Gender                    1100 non-null   object\n",
      " 9   JobInvolvement            1100 non-null   int64 \n",
      " 10  JobLevel                  1100 non-null   int64 \n",
      " 11  JobRole                   1100 non-null   object\n",
      " 12  JobSatisfaction           1100 non-null   int64 \n",
      " 13  MaritalStatus             1100 non-null   object\n",
      " 14  MonthlyIncome             1100 non-null   int64 \n",
      " 15  NumCompaniesWorked        1100 non-null   int64 \n",
      " 16  OverTime                  1100 non-null   object\n",
      " 17  PercentSalaryHike         1100 non-null   int64 \n",
      " 18  PerformanceRating         1100 non-null   int64 \n",
      " 19  RelationshipSatisfaction  1100 non-null   int64 \n",
      " 20  StockOptionLevel          1100 non-null   int64 \n",
      " 21  TotalWorkingYears         1100 non-null   int64 \n",
      " 22  TrainingTimesLastYear     1100 non-null   int64 \n",
      " 23  WorkLifeBalance           1100 non-null   int64 \n",
      " 24  YearsAtCompany            1100 non-null   int64 \n",
      " 25  YearsInCurrentRole        1100 non-null   int64 \n",
      " 26  YearsSinceLastPromotion   1100 non-null   int64 \n",
      " 27  YearsWithCurrManager      1100 non-null   int64 \n",
      "dtypes: int64(21), object(7)\n",
      "memory usage: 240.8+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.563968Z",
     "start_time": "2025-06-07T03:26:09.476587300Z"
    }
   },
   "id": "692f0f3c15381a69"
  },
  {
   "cell_type": "code",
   "execution_count": 235,
   "outputs": [
    {
     "data": {
      "text/plain": "    Attrition  Age     BusinessTravel              Department  \\\n0           0   37      Travel_Rarely  Research & Development   \n1           0   54  Travel_Frequently  Research & Development   \n2           1   34  Travel_Frequently  Research & Development   \n3           0   39      Travel_Rarely  Research & Development   \n4           1   28  Travel_Frequently  Research & Development   \n5           0   24      Travel_Rarely                   Sales   \n6           0   29      Travel_Rarely  Research & Development   \n7           0   36      Travel_Rarely                   Sales   \n8           0   33      Travel_Rarely  Research & Development   \n9           0   34      Travel_Rarely  Research & Development   \n10          1   24      Travel_Rarely         Human Resources   \n11          0   35      Travel_Rarely  Research & Development   \n12          1   30      Travel_Rarely  Research & Development   \n13          0   54      Travel_Rarely  Research & Development   \n14          0   34      Travel_Rarely  Research & Development   \n15          0   47      Travel_Rarely                   Sales   \n16          0   36         Non-Travel                   Sales   \n17          0   35      Travel_Rarely  Research & Development   \n18          0   29      Travel_Rarely                   Sales   \n19          1   56      Travel_Rarely  Research & Development   \n20          0   45      Travel_Rarely  Research & Development   \n21          0   46      Travel_Rarely  Research & Development   \n22          0   39      Travel_Rarely  Research & Development   \n23          0   52      Travel_Rarely                   Sales   \n24          0   32         Non-Travel  Research & Development   \n25          0   46  Travel_Frequently  Research & Development   \n26          0   28      Travel_Rarely  Research & Development   \n27          0   29      Travel_Rarely  Research & Development   \n28          0   39      Travel_Rarely                   Sales   \n29          0   33      Travel_Rarely  Research & Development   \n\n    DistanceFromHome  Education    EducationField  EnvironmentSatisfaction  \\\n0                  1          4     Life Sciences                        1   \n1                  1          4     Life Sciences                        4   \n2                  7          3     Life Sciences                        1   \n3                  1          1     Life Sciences                        4   \n4                  1          3           Medical                        1   \n5                  4          1           Medical                        4   \n6                  9          5             Other                        2   \n7                  2          2           Medical                        2   \n8                  4          4           Medical                        3   \n9                  2          4  Technical Degree                        3   \n10                22          1   Human Resources                        4   \n11                10          4           Medical                        1   \n12                 3          3  Technical Degree                        4   \n13                 8          4     Life Sciences                        3   \n14                 1          3     Life Sciences                        4   \n15                 2          4     Life Sciences                        4   \n16                15          4         Marketing                        4   \n17                 1          4           Medical                        4   \n18                19          3     Life Sciences                        3   \n19                14          4     Life Sciences                        2   \n20                10          2     Life Sciences                        1   \n21                 1          4           Medical                        4   \n22                10          1           Medical                        3   \n23                 3          4         Marketing                        3   \n24                 1          3     Life Sciences                        3   \n25                18          1           Medical                        1   \n26                17          2           Medical                        3   \n27                23          2     Life Sciences                        3   \n28                24          1         Marketing                        2   \n29                 9          3           Medical                        1   \n\n    Gender  JobInvolvement  ...  PerformanceRating RelationshipSatisfaction  \\\n0     Male               2  ...                  3                        3   \n1   Female               3  ...                  3                        1   \n2     Male               1  ...                  4                        4   \n3   Female               2  ...                  3                        3   \n4     Male               2  ...                  3                        1   \n5   Female               3  ...                  3                        3   \n6     Male               2  ...                  3                        3   \n7     Male               2  ...                  3                        2   \n8   Female               2  ...                  4                        4   \n9   Female               3  ...                  3                        4   \n10    Male               1  ...                  3                        3   \n11  Female               3  ...                  3                        3   \n12  Female               3  ...                  3                        3   \n13  Female               3  ...                  3                        3   \n14  Female               2  ...                  3                        1   \n15  Female               2  ...                  3                        1   \n16    Male               1  ...                  4                        1   \n17    Male               2  ...                  3                        2   \n18    Male               2  ...                  3                        3   \n19  Female               3  ...                  3                        1   \n20    Male               3  ...                  4                        4   \n21    Male               3  ...                  3                        3   \n22    Male               3  ...                  4                        3   \n23    Male               2  ...                  3                        1   \n24  Female               2  ...                  4                        3   \n25  Female               3  ...                  3                        4   \n26    Male               3  ...                  3                        4   \n27    Male               4  ...                  4                        3   \n28  Female               2  ...                  3                        1   \n29    Male               3  ...                  3                        2   \n\n    StockOptionLevel TotalWorkingYears  TrainingTimesLastYear  \\\n0                  1                 7                      2   \n1                  1                33                      2   \n2                  0                 9                      3   \n3                  1                21                      3   \n4                  2                 1                      2   \n5                  2                 5                      3   \n6                  0                 4                      2   \n7                  2                10                      2   \n8                  0                 7                      3   \n9                  0                14                      2   \n10                 1                 1                      2   \n11                 0                10                      4   \n12                 0                 8                      5   \n13                 0                19                      3   \n14                 1                 7                      2   \n15                 0                 3                      3   \n16                 1                15                      4   \n17                 1                10                      2   \n18                 2                10                      3   \n19                 3                 7                      2   \n20                 2                 8                      3   \n21                 1                17                      3   \n22                 0                 9                      3   \n23                 0                34                      3   \n24                 0                 5                      3   \n25                 0                28                      3   \n26                 1                10                      2   \n27                 1                10                      3   \n28                 1                21                      2   \n29                 1                15                      5   \n\n    WorkLifeBalance YearsAtCompany  YearsInCurrentRole  \\\n0                 4              7                   5   \n1                 1              5                   4   \n2                 3              9                   7   \n3                 3             21                   6   \n4                 3              1                   0   \n5                 3              5                   4   \n6                 3              3                   2   \n7                 3             10                   9   \n8                 3              3                   2   \n9                 4             14                  11   \n10                3              1                   0   \n11                3              5                   2   \n12                3              5                   2   \n13                3              1                   0   \n14                2              5                   4   \n15                2              3                   2   \n16                2             15                  12   \n17                3              8                   0   \n18                3             10                   7   \n19                3              5                   4   \n20                2              2                   2   \n21                3              4                   2   \n22                3              4                   3   \n23                4             34                   6   \n24                3              3                   0   \n25                2              2                   2   \n26                3             10                   0   \n27                3             10                   7   \n28                2             20                   9   \n29                3             14                  10   \n\n    YearsSinceLastPromotion  YearsWithCurrManager  \n0                         0                     7  \n1                         1                     4  \n2                         0                     6  \n3                        11                     8  \n4                         0                     0  \n5                         0                     3  \n6                         2                     2  \n7                         9                     0  \n8                         1                     1  \n9                         4                    11  \n10                        0                     0  \n11                        0                     4  \n12                        0                     4  \n13                        0                     0  \n14                        0                     2  \n15                        1                     2  \n16                       11                    11  \n17                        1                     7  \n18                        0                     4  \n19                        4                     3  \n20                        0                     2  \n21                        0                     3  \n22                        2                     2  \n23                        1                    16  \n24                        0                     2  \n25                        1                     2  \n26                        1                     8  \n27                        0                     7  \n28                        9                     6  \n29                        4                    10  \n\n[30 rows x 28 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Attrition</th>\n      <th>Age</th>\n      <th>BusinessTravel</th>\n      <th>Department</th>\n      <th>DistanceFromHome</th>\n      <th>Education</th>\n      <th>EducationField</th>\n      <th>EnvironmentSatisfaction</th>\n      <th>Gender</th>\n      <th>JobInvolvement</th>\n      <th>...</th>\n      <th>PerformanceRating</th>\n      <th>RelationshipSatisfaction</th>\n      <th>StockOptionLevel</th>\n      <th>TotalWorkingYears</th>\n      <th>TrainingTimesLastYear</th>\n      <th>WorkLifeBalance</th>\n      <th>YearsAtCompany</th>\n      <th>YearsInCurrentRole</th>\n      <th>YearsSinceLastPromotion</th>\n      <th>YearsWithCurrManager</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>37</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>4</td>\n      <td>7</td>\n      <td>5</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>0</td>\n      <td>54</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>33</td>\n      <td>2</td>\n      <td>1</td>\n      <td>5</td>\n      <td>4</td>\n      <td>1</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1</td>\n      <td>34</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>7</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>9</td>\n      <td>7</td>\n      <td>0</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>0</td>\n      <td>39</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>21</td>\n      <td>3</td>\n      <td>3</td>\n      <td>21</td>\n      <td>6</td>\n      <td>11</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1</td>\n      <td>28</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>0</td>\n      <td>24</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>4</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>5</td>\n      <td>Other</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>0</td>\n      <td>36</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>9</td>\n      <td>9</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>0</td>\n      <td>33</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>4</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>0</td>\n      <td>7</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>0</td>\n      <td>34</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Technical Degree</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>14</td>\n      <td>2</td>\n      <td>4</td>\n      <td>14</td>\n      <td>11</td>\n      <td>4</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>1</td>\n      <td>24</td>\n      <td>Travel_Rarely</td>\n      <td>Human Resources</td>\n      <td>22</td>\n      <td>1</td>\n      <td>Human Resources</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>10</td>\n      <td>4</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>1</td>\n      <td>30</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Technical Degree</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>8</td>\n      <td>5</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>0</td>\n      <td>54</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>8</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>19</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>0</td>\n      <td>34</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>0</td>\n      <td>47</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>0</td>\n      <td>36</td>\n      <td>Non-Travel</td>\n      <td>Sales</td>\n      <td>15</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>15</td>\n      <td>4</td>\n      <td>2</td>\n      <td>15</td>\n      <td>12</td>\n      <td>11</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>8</td>\n      <td>0</td>\n      <td>1</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>19</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>1</td>\n      <td>56</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>14</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>7</td>\n      <td>2</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>0</td>\n      <td>45</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>2</td>\n      <td>8</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>0</td>\n      <td>46</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>17</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>0</td>\n      <td>39</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>0</td>\n      <td>52</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>3</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>34</td>\n      <td>3</td>\n      <td>4</td>\n      <td>34</td>\n      <td>6</td>\n      <td>1</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>0</td>\n      <td>32</td>\n      <td>Non-Travel</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>0</td>\n      <td>46</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>18</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>28</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>0</td>\n      <td>28</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>17</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>0</td>\n      <td>1</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>23</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>4</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>1</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>0</td>\n      <td>39</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>24</td>\n      <td>1</td>\n      <td>Marketing</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>21</td>\n      <td>2</td>\n      <td>2</td>\n      <td>20</td>\n      <td>9</td>\n      <td>9</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>0</td>\n      <td>33</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>15</td>\n      <td>5</td>\n      <td>3</td>\n      <td>14</td>\n      <td>10</td>\n      <td>4</td>\n      <td>10</td>\n    </tr>\n  </tbody>\n</table>\n<p>30 rows × 28 columns</p>\n</div>"
     },
     "execution_count": 235,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.566097900Z",
     "start_time": "2025-06-07T03:26:09.485617Z"
    }
   },
   "id": "db0f4c31c807f5c7"
  },
  {
   "cell_type": "code",
   "execution_count": 236,
   "outputs": [
    {
     "data": {
      "text/plain": "      Attrition  Age     BusinessTravel              Department  \\\n1070          0   36      Travel_Rarely  Research & Development   \n1071          0   38      Travel_Rarely                   Sales   \n1072          1   26         Non-Travel                   Sales   \n1073          0   37      Travel_Rarely  Research & Development   \n1074          0   42  Travel_Frequently  Research & Development   \n1075          0   37      Travel_Rarely  Research & Development   \n1076          1   30  Travel_Frequently         Human Resources   \n1077          0   32      Travel_Rarely  Research & Development   \n1078          0   23      Travel_Rarely  Research & Development   \n1079          0   31      Travel_Rarely  Research & Development   \n1080          0   42      Travel_Rarely  Research & Development   \n1081          0   40         Non-Travel  Research & Development   \n1082          0   44      Travel_Rarely  Research & Development   \n1083          0   49  Travel_Frequently                   Sales   \n1084          0   29      Travel_Rarely                   Sales   \n1085          0   35      Travel_Rarely  Research & Development   \n1086          0   26      Travel_Rarely  Research & Development   \n1087          0   29  Travel_Frequently  Research & Development   \n1088          0   30      Travel_Rarely  Research & Development   \n1089          0   31      Travel_Rarely         Human Resources   \n1090          0   33      Travel_Rarely         Human Resources   \n1091          0   42      Travel_Rarely  Research & Development   \n1092          0   35  Travel_Frequently  Research & Development   \n1093          1   38      Travel_Rarely  Research & Development   \n1094          0   50  Travel_Frequently  Research & Development   \n1095          0   35      Travel_Rarely  Research & Development   \n1096          0   38      Travel_Rarely                   Sales   \n1097          0   37      Travel_Rarely                   Sales   \n1098          1   22      Travel_Rarely  Research & Development   \n1099          1   26  Travel_Frequently  Research & Development   \n\n      DistanceFromHome  Education    EducationField  EnvironmentSatisfaction  \\\n1070                 7          3     Life Sciences                        1   \n1071                14          3     Life Sciences                        3   \n1072                29          2           Medical                        2   \n1073                19          3     Life Sciences                        3   \n1074                 9          2           Medical                        1   \n1075                10          1     Life Sciences                        4   \n1076                 8          3   Human Resources                        3   \n1077                 5          4     Life Sciences                        4   \n1078                 1          2     Life Sciences                        4   \n1079                 5          4  Technical Degree                        3   \n1080                 2          3           Medical                        4   \n1081                 8          2     Life Sciences                        4   \n1082                 2          1     Life Sciences                        1   \n1083                 2          3           Medical                        4   \n1084                20          2         Marketing                        4   \n1085                22          3     Life Sciences                        2   \n1086                23          3     Life Sciences                        1   \n1087                 1          3     Life Sciences                        4   \n1088                17          4           Medical                        2   \n1089                 2          3   Human Resources                        1   \n1090                 3          2   Human Resources                        4   \n1091                23          5     Life Sciences                        1   \n1092                18          2     Life Sciences                        3   \n1093                 2          3           Medical                        3   \n1094                20          5           Medical                        2   \n1095                23          4           Medical                        3   \n1096                 2          4         Marketing                        2   \n1097                16          4         Marketing                        4   \n1098                 7          1     Life Sciences                        4   \n1099                 2          3     Life Sciences                        1   \n\n      Gender  JobInvolvement  ...  PerformanceRating RelationshipSatisfaction  \\\n1070    Male               3  ...                  3                        3   \n1071    Male               3  ...                  3                        4   \n1072    Male               1  ...                  3                        4   \n1073    Male               3  ...                  3                        1   \n1074  Female               3  ...                  3                        3   \n1075  Female               3  ...                  3                        2   \n1076  Female               2  ...                  3                        3   \n1077    Male               2  ...                  4                        2   \n1078    Male               3  ...                  4                        4   \n1079    Male               3  ...                  3                        3   \n1080  Female               2  ...                  3                        3   \n1081    Male               3  ...                  3                        3   \n1082  Female               4  ...                  3                        4   \n1083    Male               2  ...                  3                        4   \n1084    Male               3  ...                  3                        4   \n1085  Female               4  ...                  3                        2   \n1086  Female               3  ...                  4                        2   \n1087    Male               4  ...                  3                        4   \n1088  Female               3  ...                  4                        4   \n1089    Male               2  ...                  3                        4   \n1090    Male               3  ...                  3                        3   \n1091  Female               3  ...                  3                        2   \n1092    Male               3  ...                  3                        3   \n1093    Male               3  ...                  3                        1   \n1094    Male               3  ...                  3                        3   \n1095  Female               3  ...                  3                        3   \n1096  Female               1  ...                  4                        1   \n1097    Male               2  ...                  3                        4   \n1098    Male               3  ...                  4                        1   \n1099    Male               3  ...                  3                        2   \n\n      StockOptionLevel TotalWorkingYears  TrainingTimesLastYear  \\\n1070                 0                15                      4   \n1071                 1                10                      3   \n1072                 0                 7                      6   \n1073                 3                 9                      2   \n1074                 0                12                      3   \n1075                 2                 6                      3   \n1076                 1                 6                      0   \n1077                 0                 8                      1   \n1078                 1                 1                      2   \n1079                 1                 6                      4   \n1080                 1                10                      4   \n1081                 0                 8                      2   \n1082                 1                10                      5   \n1083                 0                17                      3   \n1084                 1                10                      2   \n1085                 1                10                      6   \n1086                 2                 3                      3   \n1087                 0                10                      5   \n1088                 2                 9                      2   \n1089                 0                 9                      1   \n1090                 1                 7                      4   \n1091                 0                16                      2   \n1092                 0                10                      2   \n1093                 2                 7                      2   \n1094                 1                32                      3   \n1095                 1                 4                      3   \n1096                 2                20                      4   \n1097                 2                 9                      2   \n1098                 0                 1                      2   \n1099                 1                 6                      2   \n\n      WorkLifeBalance YearsAtCompany  YearsInCurrentRole  \\\n1070                3              4                   3   \n1071                3              9                   8   \n1072                3              2                   2   \n1073                2              4                   3   \n1074                3             12                   9   \n1075                2              5                   3   \n1076                2              4                   2   \n1077                3              1                   0   \n1078                3              1                   0   \n1079                3              5                   2   \n1080                3              9                   6   \n1081                3              2                   2   \n1082                3             10                   5   \n1083                2              9                   6   \n1084                3              3                   2   \n1085                2              7                   7   \n1086                1              3                   2   \n1087                4              3                   2   \n1088                3              9                   1   \n1089                3              2                   2   \n1090                4              4                   3   \n1091                3              1                   0   \n1092                3              2                   2   \n1093                3              5                   2   \n1094                3             30                   8   \n1095                3              2                   2   \n1096                2              4                   2   \n1097                3              1                   0   \n1098                3              1                   0   \n1099                3              3                   2   \n\n      YearsSinceLastPromotion  YearsWithCurrManager  \n1070                        1                     3  \n1071                        7                     7  \n1072                        2                     2  \n1073                        0                     2  \n1074                        5                     8  \n1075                        4                     3  \n1076                        1                     2  \n1077                        0                     0  \n1078                        0                     1  \n1079                        0                     3  \n1080                        7                     8  \n1081                        2                     2  \n1082                        7                     7  \n1083                        0                     8  \n1084                        0                     2  \n1085                        6                     2  \n1086                        0                     2  \n1087                        0                     2  \n1088                        0                     8  \n1089                        1                     0  \n1090                        0                     3  \n1091                        0                     0  \n1092                        2                     2  \n1093                        1                     4  \n1094                       12                    13  \n1095                        2                     2  \n1096                        0                     3  \n1097                        0                     0  \n1098                        0                     0  \n1099                        1                     2  \n\n[30 rows x 28 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Attrition</th>\n      <th>Age</th>\n      <th>BusinessTravel</th>\n      <th>Department</th>\n      <th>DistanceFromHome</th>\n      <th>Education</th>\n      <th>EducationField</th>\n      <th>EnvironmentSatisfaction</th>\n      <th>Gender</th>\n      <th>JobInvolvement</th>\n      <th>...</th>\n      <th>PerformanceRating</th>\n      <th>RelationshipSatisfaction</th>\n      <th>StockOptionLevel</th>\n      <th>TotalWorkingYears</th>\n      <th>TrainingTimesLastYear</th>\n      <th>WorkLifeBalance</th>\n      <th>YearsAtCompany</th>\n      <th>YearsInCurrentRole</th>\n      <th>YearsSinceLastPromotion</th>\n      <th>YearsWithCurrManager</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>1070</th>\n      <td>0</td>\n      <td>36</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>7</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>15</td>\n      <td>4</td>\n      <td>3</td>\n      <td>4</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>1071</th>\n      <td>0</td>\n      <td>38</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>14</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>9</td>\n      <td>8</td>\n      <td>7</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>1072</th>\n      <td>1</td>\n      <td>26</td>\n      <td>Non-Travel</td>\n      <td>Sales</td>\n      <td>29</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>7</td>\n      <td>6</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1073</th>\n      <td>0</td>\n      <td>37</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>19</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>9</td>\n      <td>2</td>\n      <td>2</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1074</th>\n      <td>0</td>\n      <td>42</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>12</td>\n      <td>3</td>\n      <td>3</td>\n      <td>12</td>\n      <td>9</td>\n      <td>5</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>1075</th>\n      <td>0</td>\n      <td>37</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>6</td>\n      <td>3</td>\n      <td>2</td>\n      <td>5</td>\n      <td>3</td>\n      <td>4</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>1076</th>\n      <td>1</td>\n      <td>30</td>\n      <td>Travel_Frequently</td>\n      <td>Human Resources</td>\n      <td>8</td>\n      <td>3</td>\n      <td>Human Resources</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>6</td>\n      <td>0</td>\n      <td>2</td>\n      <td>4</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1077</th>\n      <td>0</td>\n      <td>32</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>5</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>2</td>\n      <td>0</td>\n      <td>8</td>\n      <td>1</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1078</th>\n      <td>0</td>\n      <td>23</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>1079</th>\n      <td>0</td>\n      <td>31</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>5</td>\n      <td>4</td>\n      <td>Technical Degree</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>6</td>\n      <td>4</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>1080</th>\n      <td>0</td>\n      <td>42</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>10</td>\n      <td>4</td>\n      <td>3</td>\n      <td>9</td>\n      <td>6</td>\n      <td>7</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>1081</th>\n      <td>0</td>\n      <td>40</td>\n      <td>Non-Travel</td>\n      <td>Research &amp; Development</td>\n      <td>8</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>8</td>\n      <td>2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1082</th>\n      <td>0</td>\n      <td>44</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>4</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>10</td>\n      <td>5</td>\n      <td>3</td>\n      <td>10</td>\n      <td>5</td>\n      <td>7</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>1083</th>\n      <td>0</td>\n      <td>49</td>\n      <td>Travel_Frequently</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>17</td>\n      <td>3</td>\n      <td>2</td>\n      <td>9</td>\n      <td>6</td>\n      <td>0</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>1084</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>20</td>\n      <td>2</td>\n      <td>Marketing</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1085</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>22</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>4</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>10</td>\n      <td>6</td>\n      <td>2</td>\n      <td>7</td>\n      <td>7</td>\n      <td>6</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1086</th>\n      <td>0</td>\n      <td>26</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>23</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>2</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1087</th>\n      <td>0</td>\n      <td>29</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>4</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>10</td>\n      <td>5</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1088</th>\n      <td>0</td>\n      <td>30</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>17</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>2</td>\n      <td>9</td>\n      <td>2</td>\n      <td>3</td>\n      <td>9</td>\n      <td>1</td>\n      <td>0</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>1089</th>\n      <td>0</td>\n      <td>31</td>\n      <td>Travel_Rarely</td>\n      <td>Human Resources</td>\n      <td>2</td>\n      <td>3</td>\n      <td>Human Resources</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>9</td>\n      <td>1</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1090</th>\n      <td>0</td>\n      <td>33</td>\n      <td>Travel_Rarely</td>\n      <td>Human Resources</td>\n      <td>3</td>\n      <td>2</td>\n      <td>Human Resources</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>7</td>\n      <td>4</td>\n      <td>4</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>1091</th>\n      <td>0</td>\n      <td>42</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>23</td>\n      <td>5</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>0</td>\n      <td>16</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1092</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>18</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1093</th>\n      <td>1</td>\n      <td>38</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>2</td>\n      <td>7</td>\n      <td>2</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>1</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>1094</th>\n      <td>0</td>\n      <td>50</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>20</td>\n      <td>5</td>\n      <td>Medical</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>32</td>\n      <td>3</td>\n      <td>3</td>\n      <td>30</td>\n      <td>8</td>\n      <td>12</td>\n      <td>13</td>\n    </tr>\n    <tr>\n      <th>1095</th>\n      <td>0</td>\n      <td>35</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>23</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>4</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>1096</th>\n      <td>0</td>\n      <td>38</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>2</td>\n      <td>20</td>\n      <td>4</td>\n      <td>2</td>\n      <td>4</td>\n      <td>2</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>1097</th>\n      <td>0</td>\n      <td>37</td>\n      <td>Travel_Rarely</td>\n      <td>Sales</td>\n      <td>16</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>9</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1098</th>\n      <td>1</td>\n      <td>22</td>\n      <td>Travel_Rarely</td>\n      <td>Research &amp; Development</td>\n      <td>7</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>0</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>1099</th>\n      <td>1</td>\n      <td>26</td>\n      <td>Travel_Frequently</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>6</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n  </tbody>\n</table>\n<p>30 rows × 28 columns</p>\n</div>"
     },
     "execution_count": 236,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.tail(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.578123700Z",
     "start_time": "2025-06-07T03:26:09.499425900Z"
    }
   },
   "id": "4f2ae63f7c9ea719"
  },
  {
   "cell_type": "code",
   "execution_count": 237,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 28 columns):\n",
      " #   Column                    Non-Null Count  Dtype \n",
      "---  ------                    --------------  ----- \n",
      " 0   Attrition                 1100 non-null   int64 \n",
      " 1   Age                       1100 non-null   int64 \n",
      " 2   BusinessTravel            1100 non-null   object\n",
      " 3   Department                1100 non-null   object\n",
      " 4   DistanceFromHome          1100 non-null   int64 \n",
      " 5   Education                 1100 non-null   int64 \n",
      " 6   EducationField            1100 non-null   object\n",
      " 7   EnvironmentSatisfaction   1100 non-null   int64 \n",
      " 8   Gender                    1100 non-null   object\n",
      " 9   JobInvolvement            1100 non-null   int64 \n",
      " 10  JobLevel                  1100 non-null   int64 \n",
      " 11  JobRole                   1100 non-null   object\n",
      " 12  JobSatisfaction           1100 non-null   int64 \n",
      " 13  MaritalStatus             1100 non-null   object\n",
      " 14  MonthlyIncome             1100 non-null   int64 \n",
      " 15  NumCompaniesWorked        1100 non-null   int64 \n",
      " 16  OverTime                  1100 non-null   object\n",
      " 17  PercentSalaryHike         1100 non-null   int64 \n",
      " 18  PerformanceRating         1100 non-null   int64 \n",
      " 19  RelationshipSatisfaction  1100 non-null   int64 \n",
      " 20  StockOptionLevel          1100 non-null   int64 \n",
      " 21  TotalWorkingYears         1100 non-null   int64 \n",
      " 22  TrainingTimesLastYear     1100 non-null   int64 \n",
      " 23  WorkLifeBalance           1100 non-null   int64 \n",
      " 24  YearsAtCompany            1100 non-null   int64 \n",
      " 25  YearsInCurrentRole        1100 non-null   int64 \n",
      " 26  YearsSinceLastPromotion   1100 non-null   int64 \n",
      " 27  YearsWithCurrManager      1100 non-null   int64 \n",
      "dtypes: int64(21), object(7)\n",
      "memory usage: 240.8+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.579123Z",
     "start_time": "2025-06-07T03:26:09.512313800Z"
    }
   },
   "id": "aebb935a79dc65b2"
  },
  {
   "cell_type": "code",
   "execution_count": 238,
   "outputs": [],
   "source": [
    "from sklearn.preprocessing import LabelEncoder"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.580124200Z",
     "start_time": "2025-06-07T03:26:09.520487600Z"
    }
   },
   "id": "b8d0bb9bcc777bae"
  },
  {
   "cell_type": "code",
   "execution_count": 239,
   "outputs": [
    {
     "data": {
      "text/plain": "BusinessTravel\nTravel_Rarely        787\nTravel_Frequently    205\nNon-Travel           108\nName: count, dtype: int64"
     },
     "execution_count": 239,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 先看看出差字段有什么值和对应的数量\n",
    "data['BusinessTravel'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.580668300Z",
     "start_time": "2025-06-07T03:26:09.527996400Z"
    }
   },
   "id": "6df175774258f35a"
  },
  {
   "cell_type": "code",
   "execution_count": 240,
   "outputs": [],
   "source": [
    "# # 出差字段 编码改为 0 - 不出差 1 - 偶尔出差 2 - 经常出差\n",
    "# from sklearn.preprocessing import LabelEncoder\n",
    "# # 热编码前再重新复制一份\n",
    "# data_backup = data\n",
    "# data = data.copy(deep=True)\n",
    "# # 自定义顺序\n",
    "# custom_order = ['Non-Travel', 'Travel_Rarely', 'Travel_Frequently']\n",
    "# # 转换为 Categorical 并指定顺序\n",
    "# data['BusinessTravel'] = pd.Categorical(data['BusinessTravel'], categories=custom_order, ordered=True)\n",
    "# \n",
    "# # 再使用 LabelEncoder 进行编码\n",
    "# data['BusinessTravel'] = LabelEncoder().fit_transform(data['BusinessTravel'])\n",
    "# \n",
    "# data['BusinessTravel'].head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.580668300Z",
     "start_time": "2025-06-07T03:26:09.535447100Z"
    }
   },
   "id": "38ccf259c0cfce10"
  },
  {
   "cell_type": "code",
   "execution_count": 241,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "BusinessTravel\n",
      "Travel_Rarely        787\n",
      "Travel_Frequently    205\n",
      "Non-Travel           108\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(data['BusinessTravel'].value_counts())"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.580668300Z",
     "start_time": "2025-06-07T03:26:09.541721300Z"
    }
   },
   "id": "3a2a2f7599ff7755"
  },
  {
   "cell_type": "code",
   "execution_count": 242,
   "outputs": [
    {
     "data": {
      "text/plain": "BusinessTravel\n1    787\n2    205\n0    108\nName: count, dtype: int64"
     },
     "execution_count": 242,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 上述的方法必须要赋值给一个新列，否则会导致编码出问题，因为列的属性改变了，变成pd.Categorical类型\n",
    "# 所以这里采用最简单的mapping映射方法\n",
    "# 热编码前再重新复制一份\n",
    "data_backup = data\n",
    "data = data.copy(deep=True)\n",
    "# 手动定义映射关系\n",
    "mapping = {'Non-Travel': 0, 'Travel_Rarely': 1, 'Travel_Frequently': 2}\n",
    "# 使用 map() 替换，默认\n",
    "data['BusinessTravel'] = data['BusinessTravel'].map(mapping)\n",
    "# 查看结果\n",
    "# data[['BusinessTravel', 'BusinessTravel_encoded']].head(30)\n",
    "data['BusinessTravel'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.581171600Z",
     "start_time": "2025-06-07T03:26:09.549176300Z"
    }
   },
   "id": "8ac3325149e86ec8"
  },
  {
   "cell_type": "code",
   "execution_count": 243,
   "outputs": [
    {
     "data": {
      "text/plain": "Department\nResearch & Development    727\nSales                     331\nHuman Resources            42\nName: count, dtype: int64"
     },
     "execution_count": 243,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 打印部门列的值和对应的数量\n",
    "data['Department'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.588276600Z",
     "start_time": "2025-06-07T03:26:09.559038Z"
    }
   },
   "id": "8f5498c5501f2651"
  },
  {
   "cell_type": "code",
   "execution_count": 244,
   "outputs": [
    {
     "data": {
      "text/plain": "    Attrition  Age  BusinessTravel              Department  DistanceFromHome  \\\n0           0   37               1  Research & Development                 1   \n1           0   54               2  Research & Development                 1   \n2           1   34               2  Research & Development                 7   \n3           0   39               1  Research & Development                 1   \n4           1   28               2  Research & Development                 1   \n5           0   24               1                   Sales                 4   \n6           0   29               1  Research & Development                 9   \n7           0   36               1                   Sales                 2   \n8           0   33               1  Research & Development                 4   \n9           0   34               1  Research & Development                 2   \n10          1   24               1         Human Resources                22   \n11          0   35               1  Research & Development                10   \n12          1   30               1  Research & Development                 3   \n13          0   54               1  Research & Development                 8   \n14          0   34               1  Research & Development                 1   \n15          0   47               1                   Sales                 2   \n16          0   36               0                   Sales                15   \n17          0   35               1  Research & Development                 1   \n18          0   29               1                   Sales                19   \n19          1   56               1  Research & Development                14   \n20          0   45               1  Research & Development                10   \n21          0   46               1  Research & Development                 1   \n22          0   39               1  Research & Development                10   \n23          0   52               1                   Sales                 3   \n24          0   32               0  Research & Development                 1   \n25          0   46               2  Research & Development                18   \n26          0   28               1  Research & Development                17   \n27          0   29               1  Research & Development                23   \n28          0   39               1                   Sales                24   \n29          0   33               1  Research & Development                 9   \n\n    Education    EducationField  EnvironmentSatisfaction  Gender  \\\n0           4     Life Sciences                        1    Male   \n1           4     Life Sciences                        4  Female   \n2           3     Life Sciences                        1    Male   \n3           1     Life Sciences                        4  Female   \n4           3           Medical                        1    Male   \n5           1           Medical                        4  Female   \n6           5             Other                        2    Male   \n7           2           Medical                        2    Male   \n8           4           Medical                        3  Female   \n9           4  Technical Degree                        3  Female   \n10          1   Human Resources                        4    Male   \n11          4           Medical                        1  Female   \n12          3  Technical Degree                        4  Female   \n13          4     Life Sciences                        3  Female   \n14          3     Life Sciences                        4  Female   \n15          4     Life Sciences                        4  Female   \n16          4         Marketing                        4    Male   \n17          4           Medical                        4    Male   \n18          3     Life Sciences                        3    Male   \n19          4     Life Sciences                        2  Female   \n20          2     Life Sciences                        1    Male   \n21          4           Medical                        4    Male   \n22          1           Medical                        3    Male   \n23          4         Marketing                        3    Male   \n24          3     Life Sciences                        3  Female   \n25          1           Medical                        1  Female   \n26          2           Medical                        3    Male   \n27          2     Life Sciences                        3    Male   \n28          1         Marketing                        2  Female   \n29          3           Medical                        1    Male   \n\n    JobInvolvement  ...  PerformanceRating RelationshipSatisfaction  \\\n0                2  ...                  3                        3   \n1                3  ...                  3                        1   \n2                1  ...                  4                        4   \n3                2  ...                  3                        3   \n4                2  ...                  3                        1   \n5                3  ...                  3                        3   \n6                2  ...                  3                        3   \n7                2  ...                  3                        2   \n8                2  ...                  4                        4   \n9                3  ...                  3                        4   \n10               1  ...                  3                        3   \n11               3  ...                  3                        3   \n12               3  ...                  3                        3   \n13               3  ...                  3                        3   \n14               2  ...                  3                        1   \n15               2  ...                  3                        1   \n16               1  ...                  4                        1   \n17               2  ...                  3                        2   \n18               2  ...                  3                        3   \n19               3  ...                  3                        1   \n20               3  ...                  4                        4   \n21               3  ...                  3                        3   \n22               3  ...                  4                        3   \n23               2  ...                  3                        1   \n24               2  ...                  4                        3   \n25               3  ...                  3                        4   \n26               3  ...                  3                        4   \n27               4  ...                  4                        3   \n28               2  ...                  3                        1   \n29               3  ...                  3                        2   \n\n    StockOptionLevel TotalWorkingYears  TrainingTimesLastYear  \\\n0                  1                 7                      2   \n1                  1                33                      2   \n2                  0                 9                      3   \n3                  1                21                      3   \n4                  2                 1                      2   \n5                  2                 5                      3   \n6                  0                 4                      2   \n7                  2                10                      2   \n8                  0                 7                      3   \n9                  0                14                      2   \n10                 1                 1                      2   \n11                 0                10                      4   \n12                 0                 8                      5   \n13                 0                19                      3   \n14                 1                 7                      2   \n15                 0                 3                      3   \n16                 1                15                      4   \n17                 1                10                      2   \n18                 2                10                      3   \n19                 3                 7                      2   \n20                 2                 8                      3   \n21                 1                17                      3   \n22                 0                 9                      3   \n23                 0                34                      3   \n24                 0                 5                      3   \n25                 0                28                      3   \n26                 1                10                      2   \n27                 1                10                      3   \n28                 1                21                      2   \n29                 1                15                      5   \n\n    WorkLifeBalance YearsAtCompany  YearsInCurrentRole  \\\n0                 4              7                   5   \n1                 1              5                   4   \n2                 3              9                   7   \n3                 3             21                   6   \n4                 3              1                   0   \n5                 3              5                   4   \n6                 3              3                   2   \n7                 3             10                   9   \n8                 3              3                   2   \n9                 4             14                  11   \n10                3              1                   0   \n11                3              5                   2   \n12                3              5                   2   \n13                3              1                   0   \n14                2              5                   4   \n15                2              3                   2   \n16                2             15                  12   \n17                3              8                   0   \n18                3             10                   7   \n19                3              5                   4   \n20                2              2                   2   \n21                3              4                   2   \n22                3              4                   3   \n23                4             34                   6   \n24                3              3                   0   \n25                2              2                   2   \n26                3             10                   0   \n27                3             10                   7   \n28                2             20                   9   \n29                3             14                  10   \n\n    YearsSinceLastPromotion  YearsWithCurrManager  \n0                         0                     7  \n1                         1                     4  \n2                         0                     6  \n3                        11                     8  \n4                         0                     0  \n5                         0                     3  \n6                         2                     2  \n7                         9                     0  \n8                         1                     1  \n9                         4                    11  \n10                        0                     0  \n11                        0                     4  \n12                        0                     4  \n13                        0                     0  \n14                        0                     2  \n15                        1                     2  \n16                       11                    11  \n17                        1                     7  \n18                        0                     4  \n19                        4                     3  \n20                        0                     2  \n21                        0                     3  \n22                        2                     2  \n23                        1                    16  \n24                        0                     2  \n25                        1                     2  \n26                        1                     8  \n27                        0                     7  \n28                        9                     6  \n29                        4                    10  \n\n[30 rows x 28 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Attrition</th>\n      <th>Age</th>\n      <th>BusinessTravel</th>\n      <th>Department</th>\n      <th>DistanceFromHome</th>\n      <th>Education</th>\n      <th>EducationField</th>\n      <th>EnvironmentSatisfaction</th>\n      <th>Gender</th>\n      <th>JobInvolvement</th>\n      <th>...</th>\n      <th>PerformanceRating</th>\n      <th>RelationshipSatisfaction</th>\n      <th>StockOptionLevel</th>\n      <th>TotalWorkingYears</th>\n      <th>TrainingTimesLastYear</th>\n      <th>WorkLifeBalance</th>\n      <th>YearsAtCompany</th>\n      <th>YearsInCurrentRole</th>\n      <th>YearsSinceLastPromotion</th>\n      <th>YearsWithCurrManager</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>37</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>4</td>\n      <td>7</td>\n      <td>5</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>0</td>\n      <td>54</td>\n      <td>2</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>33</td>\n      <td>2</td>\n      <td>1</td>\n      <td>5</td>\n      <td>4</td>\n      <td>1</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1</td>\n      <td>34</td>\n      <td>2</td>\n      <td>Research &amp; Development</td>\n      <td>7</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>9</td>\n      <td>7</td>\n      <td>0</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>0</td>\n      <td>39</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>21</td>\n      <td>3</td>\n      <td>3</td>\n      <td>21</td>\n      <td>6</td>\n      <td>11</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1</td>\n      <td>28</td>\n      <td>2</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>0</td>\n      <td>24</td>\n      <td>1</td>\n      <td>Sales</td>\n      <td>4</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>0</td>\n      <td>29</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>5</td>\n      <td>Other</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>0</td>\n      <td>36</td>\n      <td>1</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>9</td>\n      <td>9</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>0</td>\n      <td>33</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>4</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>0</td>\n      <td>7</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>0</td>\n      <td>34</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Technical Degree</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>14</td>\n      <td>2</td>\n      <td>4</td>\n      <td>14</td>\n      <td>11</td>\n      <td>4</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>1</td>\n      <td>24</td>\n      <td>1</td>\n      <td>Human Resources</td>\n      <td>22</td>\n      <td>1</td>\n      <td>Human Resources</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>0</td>\n      <td>35</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>10</td>\n      <td>4</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>1</td>\n      <td>30</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Technical Degree</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>8</td>\n      <td>5</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>0</td>\n      <td>54</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>8</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>19</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>0</td>\n      <td>34</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>0</td>\n      <td>47</td>\n      <td>1</td>\n      <td>Sales</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>0</td>\n      <td>36</td>\n      <td>0</td>\n      <td>Sales</td>\n      <td>15</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>15</td>\n      <td>4</td>\n      <td>2</td>\n      <td>15</td>\n      <td>12</td>\n      <td>11</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>0</td>\n      <td>35</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>8</td>\n      <td>0</td>\n      <td>1</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>0</td>\n      <td>29</td>\n      <td>1</td>\n      <td>Sales</td>\n      <td>19</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>1</td>\n      <td>56</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>14</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>7</td>\n      <td>2</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>0</td>\n      <td>45</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>2</td>\n      <td>8</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>0</td>\n      <td>46</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>17</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>0</td>\n      <td>39</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>10</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>0</td>\n      <td>52</td>\n      <td>1</td>\n      <td>Sales</td>\n      <td>3</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>34</td>\n      <td>3</td>\n      <td>4</td>\n      <td>34</td>\n      <td>6</td>\n      <td>1</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>0</td>\n      <td>32</td>\n      <td>0</td>\n      <td>Research &amp; Development</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>0</td>\n      <td>46</td>\n      <td>2</td>\n      <td>Research &amp; Development</td>\n      <td>18</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>28</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>0</td>\n      <td>28</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>17</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>0</td>\n      <td>1</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>0</td>\n      <td>29</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>23</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>4</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>1</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>0</td>\n      <td>39</td>\n      <td>1</td>\n      <td>Sales</td>\n      <td>24</td>\n      <td>1</td>\n      <td>Marketing</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>21</td>\n      <td>2</td>\n      <td>2</td>\n      <td>20</td>\n      <td>9</td>\n      <td>9</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>0</td>\n      <td>33</td>\n      <td>1</td>\n      <td>Research &amp; Development</td>\n      <td>9</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>15</td>\n      <td>5</td>\n      <td>3</td>\n      <td>14</td>\n      <td>10</td>\n      <td>4</td>\n      <td>10</td>\n    </tr>\n  </tbody>\n</table>\n<p>30 rows × 28 columns</p>\n</div>"
     },
     "execution_count": 244,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.664863100Z",
     "start_time": "2025-06-07T03:26:09.568608500Z"
    }
   },
   "id": "12f9d2ca962247f9"
  },
  {
   "cell_type": "code",
   "execution_count": 245,
   "outputs": [
    {
     "data": {
      "text/plain": "Department\n2    727\n3    331\n1     42\nName: count, dtype: int64"
     },
     "execution_count": 245,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_backup = data\n",
    "data = data.copy(deep=True)\n",
    "# 此处也一样采用映射方法\n",
    "mapping = {'Human Resources': 1, 'Research & Development': 2, 'Sales': 3}\n",
    "# data['Department_en'] = data['Department'].map(mapping)\n",
    "# data[['Department', 'Department_en']].head(30)\n",
    "data['Department'] = data['Department'].map(mapping)\n",
    "data['Department'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.666418700Z",
     "start_time": "2025-06-07T03:26:09.583175200Z"
    }
   },
   "id": "3485a529604e4991"
  },
  {
   "cell_type": "code",
   "execution_count": 246,
   "outputs": [
    {
     "data": {
      "text/plain": "    Attrition  Age  BusinessTravel  Department  DistanceFromHome  Education  \\\n0           0   37               1           2                 1          4   \n1           0   54               2           2                 1          4   \n2           1   34               2           2                 7          3   \n3           0   39               1           2                 1          1   \n4           1   28               2           2                 1          3   \n5           0   24               1           3                 4          1   \n6           0   29               1           2                 9          5   \n7           0   36               1           3                 2          2   \n8           0   33               1           2                 4          4   \n9           0   34               1           2                 2          4   \n10          1   24               1           1                22          1   \n11          0   35               1           2                10          4   \n12          1   30               1           2                 3          3   \n13          0   54               1           2                 8          4   \n14          0   34               1           2                 1          3   \n15          0   47               1           3                 2          4   \n16          0   36               0           3                15          4   \n17          0   35               1           2                 1          4   \n18          0   29               1           3                19          3   \n19          1   56               1           2                14          4   \n20          0   45               1           2                10          2   \n21          0   46               1           2                 1          4   \n22          0   39               1           2                10          1   \n23          0   52               1           3                 3          4   \n24          0   32               0           2                 1          3   \n25          0   46               2           2                18          1   \n26          0   28               1           2                17          2   \n27          0   29               1           2                23          2   \n28          0   39               1           3                24          1   \n29          0   33               1           2                 9          3   \n\n      EducationField  EnvironmentSatisfaction  Gender  JobInvolvement  ...  \\\n0      Life Sciences                        1    Male               2  ...   \n1      Life Sciences                        4  Female               3  ...   \n2      Life Sciences                        1    Male               1  ...   \n3      Life Sciences                        4  Female               2  ...   \n4            Medical                        1    Male               2  ...   \n5            Medical                        4  Female               3  ...   \n6              Other                        2    Male               2  ...   \n7            Medical                        2    Male               2  ...   \n8            Medical                        3  Female               2  ...   \n9   Technical Degree                        3  Female               3  ...   \n10   Human Resources                        4    Male               1  ...   \n11           Medical                        1  Female               3  ...   \n12  Technical Degree                        4  Female               3  ...   \n13     Life Sciences                        3  Female               3  ...   \n14     Life Sciences                        4  Female               2  ...   \n15     Life Sciences                        4  Female               2  ...   \n16         Marketing                        4    Male               1  ...   \n17           Medical                        4    Male               2  ...   \n18     Life Sciences                        3    Male               2  ...   \n19     Life Sciences                        2  Female               3  ...   \n20     Life Sciences                        1    Male               3  ...   \n21           Medical                        4    Male               3  ...   \n22           Medical                        3    Male               3  ...   \n23         Marketing                        3    Male               2  ...   \n24     Life Sciences                        3  Female               2  ...   \n25           Medical                        1  Female               3  ...   \n26           Medical                        3    Male               3  ...   \n27     Life Sciences                        3    Male               4  ...   \n28         Marketing                        2  Female               2  ...   \n29           Medical                        1    Male               3  ...   \n\n    PerformanceRating RelationshipSatisfaction  StockOptionLevel  \\\n0                   3                        3                 1   \n1                   3                        1                 1   \n2                   4                        4                 0   \n3                   3                        3                 1   \n4                   3                        1                 2   \n5                   3                        3                 2   \n6                   3                        3                 0   \n7                   3                        2                 2   \n8                   4                        4                 0   \n9                   3                        4                 0   \n10                  3                        3                 1   \n11                  3                        3                 0   \n12                  3                        3                 0   \n13                  3                        3                 0   \n14                  3                        1                 1   \n15                  3                        1                 0   \n16                  4                        1                 1   \n17                  3                        2                 1   \n18                  3                        3                 2   \n19                  3                        1                 3   \n20                  4                        4                 2   \n21                  3                        3                 1   \n22                  4                        3                 0   \n23                  3                        1                 0   \n24                  4                        3                 0   \n25                  3                        4                 0   \n26                  3                        4                 1   \n27                  4                        3                 1   \n28                  3                        1                 1   \n29                  3                        2                 1   \n\n   TotalWorkingYears  TrainingTimesLastYear  WorkLifeBalance YearsAtCompany  \\\n0                  7                      2                4              7   \n1                 33                      2                1              5   \n2                  9                      3                3              9   \n3                 21                      3                3             21   \n4                  1                      2                3              1   \n5                  5                      3                3              5   \n6                  4                      2                3              3   \n7                 10                      2                3             10   \n8                  7                      3                3              3   \n9                 14                      2                4             14   \n10                 1                      2                3              1   \n11                10                      4                3              5   \n12                 8                      5                3              5   \n13                19                      3                3              1   \n14                 7                      2                2              5   \n15                 3                      3                2              3   \n16                15                      4                2             15   \n17                10                      2                3              8   \n18                10                      3                3             10   \n19                 7                      2                3              5   \n20                 8                      3                2              2   \n21                17                      3                3              4   \n22                 9                      3                3              4   \n23                34                      3                4             34   \n24                 5                      3                3              3   \n25                28                      3                2              2   \n26                10                      2                3             10   \n27                10                      3                3             10   \n28                21                      2                2             20   \n29                15                      5                3             14   \n\n    YearsInCurrentRole  YearsSinceLastPromotion  YearsWithCurrManager  \n0                    5                        0                     7  \n1                    4                        1                     4  \n2                    7                        0                     6  \n3                    6                       11                     8  \n4                    0                        0                     0  \n5                    4                        0                     3  \n6                    2                        2                     2  \n7                    9                        9                     0  \n8                    2                        1                     1  \n9                   11                        4                    11  \n10                   0                        0                     0  \n11                   2                        0                     4  \n12                   2                        0                     4  \n13                   0                        0                     0  \n14                   4                        0                     2  \n15                   2                        1                     2  \n16                  12                       11                    11  \n17                   0                        1                     7  \n18                   7                        0                     4  \n19                   4                        4                     3  \n20                   2                        0                     2  \n21                   2                        0                     3  \n22                   3                        2                     2  \n23                   6                        1                    16  \n24                   0                        0                     2  \n25                   2                        1                     2  \n26                   0                        1                     8  \n27                   7                        0                     7  \n28                   9                        9                     6  \n29                  10                        4                    10  \n\n[30 rows x 28 columns]",
      "text/html": "<div>\n<style scoped>\n    .dataframe tbody tr th:only-of-type {\n        vertical-align: middle;\n    }\n\n    .dataframe tbody tr th {\n        vertical-align: top;\n    }\n\n    .dataframe thead th {\n        text-align: right;\n    }\n</style>\n<table border=\"1\" class=\"dataframe\">\n  <thead>\n    <tr style=\"text-align: right;\">\n      <th></th>\n      <th>Attrition</th>\n      <th>Age</th>\n      <th>BusinessTravel</th>\n      <th>Department</th>\n      <th>DistanceFromHome</th>\n      <th>Education</th>\n      <th>EducationField</th>\n      <th>EnvironmentSatisfaction</th>\n      <th>Gender</th>\n      <th>JobInvolvement</th>\n      <th>...</th>\n      <th>PerformanceRating</th>\n      <th>RelationshipSatisfaction</th>\n      <th>StockOptionLevel</th>\n      <th>TotalWorkingYears</th>\n      <th>TrainingTimesLastYear</th>\n      <th>WorkLifeBalance</th>\n      <th>YearsAtCompany</th>\n      <th>YearsInCurrentRole</th>\n      <th>YearsSinceLastPromotion</th>\n      <th>YearsWithCurrManager</th>\n    </tr>\n  </thead>\n  <tbody>\n    <tr>\n      <th>0</th>\n      <td>0</td>\n      <td>37</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>4</td>\n      <td>7</td>\n      <td>5</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>1</th>\n      <td>0</td>\n      <td>54</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>33</td>\n      <td>2</td>\n      <td>1</td>\n      <td>5</td>\n      <td>4</td>\n      <td>1</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>2</th>\n      <td>1</td>\n      <td>34</td>\n      <td>2</td>\n      <td>2</td>\n      <td>7</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>9</td>\n      <td>7</td>\n      <td>0</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>3</th>\n      <td>0</td>\n      <td>39</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>21</td>\n      <td>3</td>\n      <td>3</td>\n      <td>21</td>\n      <td>6</td>\n      <td>11</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>4</th>\n      <td>1</td>\n      <td>28</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>5</th>\n      <td>0</td>\n      <td>24</td>\n      <td>1</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>6</th>\n      <td>0</td>\n      <td>29</td>\n      <td>1</td>\n      <td>2</td>\n      <td>9</td>\n      <td>5</td>\n      <td>Other</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>4</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>7</th>\n      <td>0</td>\n      <td>36</td>\n      <td>1</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>2</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>9</td>\n      <td>9</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>8</th>\n      <td>0</td>\n      <td>33</td>\n      <td>1</td>\n      <td>2</td>\n      <td>4</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>0</td>\n      <td>7</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>1</td>\n    </tr>\n    <tr>\n      <th>9</th>\n      <td>0</td>\n      <td>34</td>\n      <td>1</td>\n      <td>2</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Technical Degree</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>14</td>\n      <td>2</td>\n      <td>4</td>\n      <td>14</td>\n      <td>11</td>\n      <td>4</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>10</th>\n      <td>1</td>\n      <td>24</td>\n      <td>1</td>\n      <td>1</td>\n      <td>22</td>\n      <td>1</td>\n      <td>Human Resources</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>11</th>\n      <td>0</td>\n      <td>35</td>\n      <td>1</td>\n      <td>2</td>\n      <td>10</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>10</td>\n      <td>4</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>12</th>\n      <td>1</td>\n      <td>30</td>\n      <td>1</td>\n      <td>2</td>\n      <td>3</td>\n      <td>3</td>\n      <td>Technical Degree</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>8</td>\n      <td>5</td>\n      <td>3</td>\n      <td>5</td>\n      <td>2</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>13</th>\n      <td>0</td>\n      <td>54</td>\n      <td>1</td>\n      <td>2</td>\n      <td>8</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>19</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>0</td>\n      <td>0</td>\n    </tr>\n    <tr>\n      <th>14</th>\n      <td>0</td>\n      <td>34</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>7</td>\n      <td>2</td>\n      <td>2</td>\n      <td>5</td>\n      <td>4</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>15</th>\n      <td>0</td>\n      <td>47</td>\n      <td>1</td>\n      <td>3</td>\n      <td>2</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>4</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>16</th>\n      <td>0</td>\n      <td>36</td>\n      <td>0</td>\n      <td>3</td>\n      <td>15</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>1</td>\n      <td>...</td>\n      <td>4</td>\n      <td>1</td>\n      <td>1</td>\n      <td>15</td>\n      <td>4</td>\n      <td>2</td>\n      <td>15</td>\n      <td>12</td>\n      <td>11</td>\n      <td>11</td>\n    </tr>\n    <tr>\n      <th>17</th>\n      <td>0</td>\n      <td>35</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>8</td>\n      <td>0</td>\n      <td>1</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>18</th>\n      <td>0</td>\n      <td>29</td>\n      <td>1</td>\n      <td>3</td>\n      <td>19</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>2</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>4</td>\n    </tr>\n    <tr>\n      <th>19</th>\n      <td>1</td>\n      <td>56</td>\n      <td>1</td>\n      <td>2</td>\n      <td>14</td>\n      <td>4</td>\n      <td>Life Sciences</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>3</td>\n      <td>7</td>\n      <td>2</td>\n      <td>3</td>\n      <td>5</td>\n      <td>4</td>\n      <td>4</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>20</th>\n      <td>0</td>\n      <td>45</td>\n      <td>1</td>\n      <td>2</td>\n      <td>10</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>4</td>\n      <td>2</td>\n      <td>8</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>21</th>\n      <td>0</td>\n      <td>46</td>\n      <td>1</td>\n      <td>2</td>\n      <td>1</td>\n      <td>4</td>\n      <td>Medical</td>\n      <td>4</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>3</td>\n      <td>1</td>\n      <td>17</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>2</td>\n      <td>0</td>\n      <td>3</td>\n    </tr>\n    <tr>\n      <th>22</th>\n      <td>0</td>\n      <td>39</td>\n      <td>1</td>\n      <td>2</td>\n      <td>10</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>9</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>23</th>\n      <td>0</td>\n      <td>52</td>\n      <td>1</td>\n      <td>3</td>\n      <td>3</td>\n      <td>4</td>\n      <td>Marketing</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>0</td>\n      <td>34</td>\n      <td>3</td>\n      <td>4</td>\n      <td>34</td>\n      <td>6</td>\n      <td>1</td>\n      <td>16</td>\n    </tr>\n    <tr>\n      <th>24</th>\n      <td>0</td>\n      <td>32</td>\n      <td>0</td>\n      <td>2</td>\n      <td>1</td>\n      <td>3</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>0</td>\n      <td>5</td>\n      <td>3</td>\n      <td>3</td>\n      <td>3</td>\n      <td>0</td>\n      <td>0</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>25</th>\n      <td>0</td>\n      <td>46</td>\n      <td>2</td>\n      <td>2</td>\n      <td>18</td>\n      <td>1</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Female</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>0</td>\n      <td>28</td>\n      <td>3</td>\n      <td>2</td>\n      <td>2</td>\n      <td>2</td>\n      <td>1</td>\n      <td>2</td>\n    </tr>\n    <tr>\n      <th>26</th>\n      <td>0</td>\n      <td>28</td>\n      <td>1</td>\n      <td>2</td>\n      <td>17</td>\n      <td>2</td>\n      <td>Medical</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>4</td>\n      <td>1</td>\n      <td>10</td>\n      <td>2</td>\n      <td>3</td>\n      <td>10</td>\n      <td>0</td>\n      <td>1</td>\n      <td>8</td>\n    </tr>\n    <tr>\n      <th>27</th>\n      <td>0</td>\n      <td>29</td>\n      <td>1</td>\n      <td>2</td>\n      <td>23</td>\n      <td>2</td>\n      <td>Life Sciences</td>\n      <td>3</td>\n      <td>Male</td>\n      <td>4</td>\n      <td>...</td>\n      <td>4</td>\n      <td>3</td>\n      <td>1</td>\n      <td>10</td>\n      <td>3</td>\n      <td>3</td>\n      <td>10</td>\n      <td>7</td>\n      <td>0</td>\n      <td>7</td>\n    </tr>\n    <tr>\n      <th>28</th>\n      <td>0</td>\n      <td>39</td>\n      <td>1</td>\n      <td>3</td>\n      <td>24</td>\n      <td>1</td>\n      <td>Marketing</td>\n      <td>2</td>\n      <td>Female</td>\n      <td>2</td>\n      <td>...</td>\n      <td>3</td>\n      <td>1</td>\n      <td>1</td>\n      <td>21</td>\n      <td>2</td>\n      <td>2</td>\n      <td>20</td>\n      <td>9</td>\n      <td>9</td>\n      <td>6</td>\n    </tr>\n    <tr>\n      <th>29</th>\n      <td>0</td>\n      <td>33</td>\n      <td>1</td>\n      <td>2</td>\n      <td>9</td>\n      <td>3</td>\n      <td>Medical</td>\n      <td>1</td>\n      <td>Male</td>\n      <td>3</td>\n      <td>...</td>\n      <td>3</td>\n      <td>2</td>\n      <td>1</td>\n      <td>15</td>\n      <td>5</td>\n      <td>3</td>\n      <td>14</td>\n      <td>10</td>\n      <td>4</td>\n      <td>10</td>\n    </tr>\n  </tbody>\n</table>\n<p>30 rows × 28 columns</p>\n</div>"
     },
     "execution_count": 246,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data.head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.666922500Z",
     "start_time": "2025-06-07T03:26:09.590784700Z"
    }
   },
   "id": "132f527eae84b304"
  },
  {
   "cell_type": "code",
   "execution_count": 247,
   "outputs": [
    {
     "data": {
      "text/plain": "Education\n3    431\n4    301\n2    206\n1    126\n5     36\nName: count, dtype: int64"
     },
     "execution_count": 247,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['Education'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.683624500Z",
     "start_time": "2025-06-07T03:26:09.603826Z"
    }
   },
   "id": "9e0294bd8a8a009e"
  },
  {
   "cell_type": "code",
   "execution_count": 248,
   "outputs": [
    {
     "data": {
      "text/plain": "EducationField\nLife Sciences       462\nMedical             337\nMarketing           127\nTechnical Degree     92\nOther                63\nHuman Resources      19\nName: count, dtype: int64"
     },
     "execution_count": 248,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 查看教育领域情况列的值和对应的数量\n",
    "data['EducationField'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.683624500Z",
     "start_time": "2025-06-07T03:26:09.608411500Z"
    }
   },
   "id": "d87212189a798352"
  },
  {
   "cell_type": "code",
   "execution_count": 249,
   "outputs": [
    {
     "data": {
      "text/plain": "EducationField\n1    462\n3    337\n2    127\n5     92\n4     63\n0     19\nName: count, dtype: int64"
     },
     "execution_count": 249,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_backup = data\n",
    "data = data.copy(deep=True)\n",
    "from sklearn.preprocessing import LabelEncoder\n",
    "data['EducationField'] = LabelEncoder().fit_transform(data['EducationField'])\n",
    "data['EducationField'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.684629500Z",
     "start_time": "2025-06-07T03:26:09.615844600Z"
    }
   },
   "id": "792a10a3fedb09e0"
  },
  {
   "cell_type": "code",
   "execution_count": 250,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 28 columns):\n",
      " #   Column                    Non-Null Count  Dtype \n",
      "---  ------                    --------------  ----- \n",
      " 0   Attrition                 1100 non-null   int64 \n",
      " 1   Age                       1100 non-null   int64 \n",
      " 2   BusinessTravel            1100 non-null   int64 \n",
      " 3   Department                1100 non-null   int64 \n",
      " 4   DistanceFromHome          1100 non-null   int64 \n",
      " 5   Education                 1100 non-null   int64 \n",
      " 6   EducationField            1100 non-null   int32 \n",
      " 7   EnvironmentSatisfaction   1100 non-null   int64 \n",
      " 8   Gender                    1100 non-null   object\n",
      " 9   JobInvolvement            1100 non-null   int64 \n",
      " 10  JobLevel                  1100 non-null   int64 \n",
      " 11  JobRole                   1100 non-null   object\n",
      " 12  JobSatisfaction           1100 non-null   int64 \n",
      " 13  MaritalStatus             1100 non-null   object\n",
      " 14  MonthlyIncome             1100 non-null   int64 \n",
      " 15  NumCompaniesWorked        1100 non-null   int64 \n",
      " 16  OverTime                  1100 non-null   object\n",
      " 17  PercentSalaryHike         1100 non-null   int64 \n",
      " 18  PerformanceRating         1100 non-null   int64 \n",
      " 19  RelationshipSatisfaction  1100 non-null   int64 \n",
      " 20  StockOptionLevel          1100 non-null   int64 \n",
      " 21  TotalWorkingYears         1100 non-null   int64 \n",
      " 22  TrainingTimesLastYear     1100 non-null   int64 \n",
      " 23  WorkLifeBalance           1100 non-null   int64 \n",
      " 24  YearsAtCompany            1100 non-null   int64 \n",
      " 25  YearsInCurrentRole        1100 non-null   int64 \n",
      " 26  YearsSinceLastPromotion   1100 non-null   int64 \n",
      " 27  YearsWithCurrManager      1100 non-null   int64 \n",
      "dtypes: int32(1), int64(23), object(4)\n",
      "memory usage: 236.5+ KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.713812800Z",
     "start_time": "2025-06-07T03:26:09.622720500Z"
    }
   },
   "id": "e4c43afc77f5e715"
  },
  {
   "cell_type": "code",
   "execution_count": 251,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 28 columns):\n",
      " #   Column                    Non-Null Count  Dtype \n",
      "---  ------                    --------------  ----- \n",
      " 0   Attrition                 1100 non-null   int64 \n",
      " 1   Age                       1100 non-null   int64 \n",
      " 2   BusinessTravel            1100 non-null   int64 \n",
      " 3   Department                1100 non-null   int64 \n",
      " 4   DistanceFromHome          1100 non-null   int64 \n",
      " 5   Education                 1100 non-null   int64 \n",
      " 6   EducationField            1100 non-null   int32 \n",
      " 7   EnvironmentSatisfaction   1100 non-null   int64 \n",
      " 8   JobInvolvement            1100 non-null   int64 \n",
      " 9   JobLevel                  1100 non-null   int64 \n",
      " 10  JobRole                   1100 non-null   object\n",
      " 11  JobSatisfaction           1100 non-null   int64 \n",
      " 12  MaritalStatus             1100 non-null   object\n",
      " 13  MonthlyIncome             1100 non-null   int64 \n",
      " 14  NumCompaniesWorked        1100 non-null   int64 \n",
      " 15  PercentSalaryHike         1100 non-null   int64 \n",
      " 16  PerformanceRating         1100 non-null   int64 \n",
      " 17  RelationshipSatisfaction  1100 non-null   int64 \n",
      " 18  StockOptionLevel          1100 non-null   int64 \n",
      " 19  TotalWorkingYears         1100 non-null   int64 \n",
      " 20  TrainingTimesLastYear     1100 non-null   int64 \n",
      " 21  WorkLifeBalance           1100 non-null   int64 \n",
      " 22  YearsAtCompany            1100 non-null   int64 \n",
      " 23  YearsInCurrentRole        1100 non-null   int64 \n",
      " 24  YearsSinceLastPromotion   1100 non-null   int64 \n",
      " 25  YearsWithCurrManager      1100 non-null   int64 \n",
      " 26  Gender_Male               1100 non-null   bool  \n",
      " 27  OverTime_Yes              1100 non-null   bool  \n",
      "dtypes: bool(2), int32(1), int64(23), object(2)\n",
      "memory usage: 221.4+ KB\n"
     ]
    }
   ],
   "source": [
    "data_backup = data\n",
    "data = data.copy(deep=True)\n",
    "# 热编码处理性别和是否加班列\n",
    "data = pd.get_dummies(data, columns=['Gender', 'OverTime'], drop_first=True)\n",
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.747857700Z",
     "start_time": "2025-06-07T03:26:09.632272400Z"
    }
   },
   "id": "2177ae3c47c3a3ff"
  },
  {
   "cell_type": "code",
   "execution_count": 252,
   "outputs": [
    {
     "data": {
      "text/plain": "0        Manufacturing Director\n1        Manufacturing Director\n2         Laboratory Technician\n3        Manufacturing Director\n4         Laboratory Technician\n5               Sales Executive\n6         Laboratory Technician\n7               Sales Executive\n8            Research Scientist\n9     Healthcare Representative\n10              Human Resources\n11    Healthcare Representative\n12           Research Scientist\n13        Laboratory Technician\n14        Laboratory Technician\n15         Sales Representative\n16              Sales Executive\n17        Laboratory Technician\n18              Sales Executive\n19           Research Scientist\n20           Research Scientist\n21    Healthcare Representative\n22            Research Director\n23                      Manager\n24        Laboratory Technician\n25    Healthcare Representative\n26        Laboratory Technician\n27           Research Scientist\n28              Sales Executive\n29           Research Scientist\nName: JobRole, dtype: object"
     },
     "execution_count": 252,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['JobRole'].head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.748856300Z",
     "start_time": "2025-06-07T03:26:09.640911700Z"
    }
   },
   "id": "262b89476f91830c"
  },
  {
   "cell_type": "code",
   "execution_count": 253,
   "outputs": [
    {
     "data": {
      "text/plain": "JobRole\nSales Executive              247\nResearch Scientist           221\nLaboratory Technician        205\nManufacturing Director       101\nHealthcare Representative    100\nManager                       80\nSales Representative          57\nResearch Director             56\nHuman Resources               33\nName: count, dtype: int64"
     },
     "execution_count": 253,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['JobRole'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.748856300Z",
     "start_time": "2025-06-07T03:26:09.646659100Z"
    }
   },
   "id": "3340fa941808e0a7"
  },
  {
   "cell_type": "code",
   "execution_count": 254,
   "outputs": [
    {
     "data": {
      "text/plain": "JobRole\n7    247\n6    221\n2    205\n4    101\n0    100\n3     80\n8     57\n5     56\n1     33\nName: count, dtype: int64"
     },
     "execution_count": 254,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_backup = data\n",
    "data = data.copy(deep=True)\n",
    "data['JobRole'] = LabelEncoder().fit_transform(data['JobRole'])\n",
    "data['JobRole'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.767389Z",
     "start_time": "2025-06-07T03:26:09.652790300Z"
    }
   },
   "id": "1128a41d569dbb53"
  },
  {
   "cell_type": "code",
   "execution_count": 255,
   "outputs": [
    {
     "data": {
      "text/plain": "0     Divorced\n1     Divorced\n2       Single\n3      Married\n4     Divorced\n5      Married\n6       Single\n7      Married\n8      Married\n9       Single\n10     Married\n11      Single\n12      Single\n13      Single\n14     Married\n15      Single\n16    Divorced\n17     Married\n18    Divorced\n19     Married\n20     Married\n21    Divorced\n22      Single\n23     Married\n24     Married\n25     Married\n26    Divorced\n27     Married\n28     Married\n29     Married\nName: MaritalStatus, dtype: object"
     },
     "execution_count": 255,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['MaritalStatus'].head(30)"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.778901600Z",
     "start_time": "2025-06-07T03:26:09.660863600Z"
    }
   },
   "id": "a6ea5d6929ef38d8"
  },
  {
   "cell_type": "code",
   "execution_count": 256,
   "outputs": [
    {
     "data": {
      "text/plain": "MaritalStatus\nMarried     500\nSingle      362\nDivorced    238\nName: count, dtype: int64"
     },
     "execution_count": 256,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data['MaritalStatus'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.794423300Z",
     "start_time": "2025-06-07T03:26:09.668926500Z"
    }
   },
   "id": "ccb9fa5facc9dbf2"
  },
  {
   "cell_type": "code",
   "execution_count": 257,
   "outputs": [
    {
     "data": {
      "text/plain": "MaritalStatus\n2    500\n1    362\n0    238\nName: count, dtype: int64"
     },
     "execution_count": 257,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_backup = data\n",
    "data = data.copy(deep=True)\n",
    "\n",
    "# 映射关系处理\n",
    "mapping = {'Divorced': 0, 'Single': 1, 'Married': 2}\n",
    "data['MaritalStatus'] = data['MaritalStatus'].map(mapping)\n",
    "data['MaritalStatus'].value_counts()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.805939700Z",
     "start_time": "2025-06-07T03:26:09.677434400Z"
    }
   },
   "id": "25465eb74aa69397"
  },
  {
   "cell_type": "code",
   "execution_count": 258,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 1100 entries, 0 to 1099\n",
      "Data columns (total 28 columns):\n",
      " #   Column                    Non-Null Count  Dtype\n",
      "---  ------                    --------------  -----\n",
      " 0   Attrition                 1100 non-null   int64\n",
      " 1   Age                       1100 non-null   int64\n",
      " 2   BusinessTravel            1100 non-null   int64\n",
      " 3   Department                1100 non-null   int64\n",
      " 4   DistanceFromHome          1100 non-null   int64\n",
      " 5   Education                 1100 non-null   int64\n",
      " 6   EducationField            1100 non-null   int32\n",
      " 7   EnvironmentSatisfaction   1100 non-null   int64\n",
      " 8   JobInvolvement            1100 non-null   int64\n",
      " 9   JobLevel                  1100 non-null   int64\n",
      " 10  JobRole                   1100 non-null   int32\n",
      " 11  JobSatisfaction           1100 non-null   int64\n",
      " 12  MaritalStatus             1100 non-null   int64\n",
      " 13  MonthlyIncome             1100 non-null   int64\n",
      " 14  NumCompaniesWorked        1100 non-null   int64\n",
      " 15  PercentSalaryHike         1100 non-null   int64\n",
      " 16  PerformanceRating         1100 non-null   int64\n",
      " 17  RelationshipSatisfaction  1100 non-null   int64\n",
      " 18  StockOptionLevel          1100 non-null   int64\n",
      " 19  TotalWorkingYears         1100 non-null   int64\n",
      " 20  TrainingTimesLastYear     1100 non-null   int64\n",
      " 21  WorkLifeBalance           1100 non-null   int64\n",
      " 22  YearsAtCompany            1100 non-null   int64\n",
      " 23  YearsInCurrentRole        1100 non-null   int64\n",
      " 24  YearsSinceLastPromotion   1100 non-null   int64\n",
      " 25  YearsWithCurrManager      1100 non-null   int64\n",
      " 26  Gender_Male               1100 non-null   bool \n",
      " 27  OverTime_Yes              1100 non-null   bool \n",
      "dtypes: bool(2), int32(2), int64(24)\n",
      "memory usage: 217.1 KB\n"
     ]
    }
   ],
   "source": [
    "data.info()"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T03:26:09.878738500Z",
     "start_time": "2025-06-07T03:26:09.684629500Z"
    }
   },
   "id": "a842dfd42e453d45"
  },
  {
   "cell_type": "code",
   "execution_count": 259,
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Attrition\n",
      "0    922\n",
      "1    178\n",
      "Name: count, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "print(data['Attrition'].value_counts())"
   ],
   "metadata": {
    "collapsed": false,
    "ExecuteTime": {
     "end_time": "2025-06-07T06:44:30.333359Z",
     "start_time": "2025-06-07T06:44:30.319843600Z"
    }
   },
   "id": "3186871b095753cc"
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "outputs": [],
   "source": [],
   "metadata": {
    "collapsed": false
   },
   "id": "48d2ad49b9cc91f"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
